﻿Public Class F2_Chuc_Nang

    Private Sub Linknhapthu_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linknhapthu.LinkClicked
        Dim f As New frphieuthu
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub Linktienthucodinh_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linktienthucodinh.LinkClicked
        Dim f As New frqlthucodinh
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub Linkloaitienthu_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linkloaitienthu.LinkClicked
        Dim f As New fr_Loaithu
        f.ShowDialog()
    End Sub

    Private Sub Linktinhthue_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linktinhthue.LinkClicked
        Dim f As New F7_Thue_Thu_Nhap
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub Linklichsuthu_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linklichsuthu.LinkClicked
        Dim f As New frTimKiemThuChi
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub Linknhaptienchi_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linknhaptienchi.LinkClicked
        Dim f As New F8_Phieu_Chi
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub Linkchicodinh_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linkchicodinh.LinkClicked
        Dim f As New F10_Chi_Co_Dinh
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub Linkloaitienchi_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linkloaitienchi.LinkClicked
        Dim f As New F11_Loai_Chi
        f.ShowDialog()
    End Sub

    Private Sub Linklichsuchi_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linklichsuchi.LinkClicked
        Dim f As New frTimKiemThuChi
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub Linknganhang_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linknganhang.LinkClicked
        Dim f As New frqltknganhang
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub Linkthetindung_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linkthetindung.LinkClicked
        Dim f As New F14_The_Tin_Dung
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub Linksotietkiem_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linksotietkiem.LinkClicked
        Dim f As New F16_So_Tiet_Kiem
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub Linkbctien_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linkbctien.LinkClicked
        Dim f As New F17_Tien_Hien_Tai
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub Linkbcthuchi_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linkbcthuchi.LinkClicked
        Dim f As New F_Report
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub Linkbcchenhlech_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linkbcchenhlech.LinkClicked
        Dim f As New frTimKiemThuChi
        f.ShowDialog()
    End Sub

    Private Sub Linkbieudo_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linkbieudo.LinkClicked
        Dim f As New F_Report
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub Linktuonglai_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linktuonglai.LinkClicked
        Dim f As New F18_Du_Tinh
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub btnthoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthoat.Click
        If MessageBox.Show("Bạn muốn thoát chương trình?", "Thông báo!", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
            Me.Close()
            frmdangnhap.txtmatkhau.Text = ""
        End If
        
    End Sub

    Private Sub LinkNo_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkNo.LinkClicked
        Dim f As New F22_No
        f.Tag = Me.Tag
        f.ShowDialog()
    End Sub

    Private Sub Linkqlnd_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles Linkqlnd.LinkClicked
        Dim f As New F1_Them_Nguoi_Dung
        f.ShowDialog()
    End Sub

    Private Sub F2_Chuc_Nang_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
        frmdangnhap.txtmatkhau.Text = ""
        frmdangnhap.Show()
    End Sub

    Private Sub F2_Chuc_Nang_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim chitudong As Integer = XL_ChiCoDinh.TuDongPhatSinh(Me.Tag)
        Dim thutudong As Integer = XL_ThuCoDinh.TuDongPhatSinh(Me.Tag)
        Dim trano As Integer = XL_No.PhatSinhPhieuChi(Me.Tag)
        Dim laitietkiem As Integer = XL_SoTietKiem.PhatSinhPhieuThu(Me.Tag)
        Dim tb As String = ""
        If chitudong > 0 Then
            tb += "Phát sinh " + chitudong.ToString() + " phiếu chi tự động\n"
        End If
        If thutudong > 0 Then
            tb += "Phát sinh " + thutudong.ToString() + " phiếu thu tự động\n"
        End If
        If trano > 0 Then
            tb += "Phát sinh " + trano.ToString() + " phiếu chi trả nợ\n"
        End If
        If laitietkiem > 0 Then
            tb += "Phát sinh " + laitietkiem.ToString() + " phiếu lãi suất tiết kiệm\n"
        End If
        If tb <> "" Then
            MessageBox.Show(tb, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If
        Dim count = XL_SoTietKiem.GiaHan(Me.Tag)
        If count > 0 Then
            MessageBox.Show("Gia hạn " + count.ToString() + " sổ tiết kiệm", "Thông báo")
        End If
    End Sub
End Class